//
//  DesignatedDriverVC.m
//  Logistics
//
//  Created by enzhoukeji on 2018/8/6.
//  Copyright © 2018年 puyue.com. All rights reserved.
//

#import "DesignatedDriverVC.h"
#import "TheDriverCell.h"
@interface DesignatedDriverVC ()<UITableViewDelegate,UITableViewDataSource,TheDriverCellDelegate>
@property (nonatomic,strong) UITextField *textTF;
@property (nonatomic,strong) UIView *searchBgView;
@property (nonatomic,strong) UIImageView * headImgV;
@property (nonatomic,strong) UITableView *theDriverTV;

@end

@implementation DesignatedDriverVC
-(UIView *)searchBgView {
    if (!_searchBgView) {
        _searchBgView = [[UIView alloc]initWithFrame:CGRectMake(GTFixWidthFlaot(40), GTFixHeightFlaot(20), kMainScreen_width - GTFixWidthFlaot(80), GTFixHeightFlaot(25))];
        _searchBgView.backgroundColor = [UIColor whiteColor];
        _searchBgView.layer.cornerRadius = 5.0;
        _searchBgView.layer.masksToBounds = YES;
    }
    return _searchBgView;
}
-(UITextField *)textTF {
    if (!_textTF) {
        _textTF = [[UITextField alloc]initWithFrame:CGRectMake(GTFixWidthFlaot(30), 0, self.searchBgView.width - GTFixWidthFlaot(60), self.searchBgView.height)];
        _textTF.tintColor = [AppStyleConfiguration ColorWithTextOne];
        _textTF.textColor = [AppStyleConfiguration ColorWithTextOne];
        _textTF.placeholder = @"请输入搜索内容";
        _textTF.font = [AppStyleConfiguration appFont:14];
        _textTF.returnKeyType = UIReturnKeySearch;

    }
    return _textTF;
    
}
-(UITableView *)theDriverTV {
    if (!_theDriverTV) {
        _theDriverTV = [[UITableView alloc]initWithFrame:CGRectMake(GTFixWidthFlaot(15), kMainTopHeight, kMainScreen_width - GTFixWidthFlaot(30), kMainScreen_height - kMainTopHeight - GTFixHeightFlaot(37)) style:UITableViewStyleGrouped];
        _theDriverTV.backgroundColor = [UIColor clearColor];
        _theDriverTV.showsVerticalScrollIndicator = NO;
        _theDriverTV.separatorStyle = UITableViewCellSeparatorStyleNone;
        _theDriverTV.dataSource = self;
        _theDriverTV.delegate = self;
    }
    return _theDriverTV;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = WGColor;
    [self.navView addSubview:self.searchBgView];
    [self.searchBgView addSubview:self.textTF];
    self.headImgV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Search"]];
    self.headImgV.frame = CGRectMake(GTFixWidthFlaot(5), GTFixHeightFlaot(0), GTFixHeightFlaot(25), GTFixHeightFlaot(25));
    [self.searchBgView addSubview:self.headImgV];
    
     [self.view addSubview:self.theDriverTV];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 8;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TheDriverCell *cell=[tableView dequeueReusableCellWithIdentifier:@"TheDriverCell"];
    if (!cell) {
        cell=[[TheDriverCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TheDriverCell"];
    }
    cell.delegate = self;
    cell.indexPath = indexPath;
    return cell;
}
#pragma  mark -----cell代理
-(void)theDriverwithIndexPath:(NSIndexPath *)index withtype:(NSString *)type{
    if ([type isEqualToString:@"1"]) {
        ZFLog(@"打个电话");
    }else{
         ZFLog(@"你来吧");
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return GTFixHeightFlaot(100);
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return GTFixHeightFlaot(15);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
